
/*!
    heaTypes.h - basic types of Heaven Engine
    This file is a part of the "Heaven Engine".
    Copyright (C) 1991-2012 johnxguo GX.
*/

#ifndef __HEA_TYPES_H_INCLUDED__
#define __HEA_TYPES_H_INCLUDED__

#include "HeaCompileCfg.h"
#include "gx_include.h"

#if defined(_DEBUG)
#if defined(_HEA_WINDOWS_API_) && defined(_MSC_VER) && !defined (_WIN32_WCE)
#if defined(WIN64) || defined(_WIN64)
#include <crtdbg.h>
#define _HEA_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_CrtDbgBreak();}
#else
#define _HEA_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_asm int 3}
#endif
#else
#include "assert.h"
#define _HEA_DEBUG_BREAK_IF( _CONDITION_ ) assert( !(_CONDITION_) );
#endif
#else
#define _HEA_DEBUG_BREAK_IF( _CONDITION_ )
#endif

#if defined(IGNORE_DEPRECATED_WARNING)
#define _HEA_DEPRECATED_
#elif _MSC_VER >= 1310
#define _HEA_DEPRECATED_ __declspec(deprecated)
#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
#define _HEA_DEPRECATED_  __attribute__ ((deprecated))
#else
#define _HEA_DEPRECATED_
#endif

#if defined(_HEA_WINDOWS_API_) && defined(_MSC_VER) && (_MSC_VER > 1299) && (_MSC_VER < 1400)
#define _HEA_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX __asm mov eax,100
#else
#define _HEA_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX
#endif

#if defined(_DEBUG) && defined(HEALICHT_EXPORTS) && defined(_MSC_VER) && \
    (_MSC_VER > 1299) && !defined(_HEA_DONT_DO_MEMORY_DEBUGGING_HERE) && !defined(_WIN32_WCE)
#define CRTDBG_MAP_ALLOC
#define _CRTDBG_MAP_ALLOC
#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
#include <stdlib.h>
#include <crtdbg.h>
#define new DEBUG_CLIENTBLOCK
#endif

#if defined(_MSC_VER) && (_MSC_VER < 1300 )
#pragma warning( disable: 4786)
#endif 

#if defined(_HEA_WINDOWS_API_) && defined(_MSC_VER) && (_MSC_VER >= 1400)
//#pragma warning( disable: 4996)
//#define _CRT_SECURE_NO_DEPRECATE 1
//#define _CRT_NONSTDC_NO_DEPRECATE 1
#endif

#define MAKE_HEA_ID(c0, c1, c2, c3) \
    ((HEA::u32)(HEA::u8)(c0) | ((HEA::u32)(HEA::u8)(c1) << 8) | \
    ((HEA::u32)(HEA::u8)(c2) << 16) | ((HEA::u32)(HEA::u8)(c3) << 24 ))

#if defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
#define _strcmpi(a,b) strcmpi(a,b)
#endif

#endif